﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Wangzeran.CodeMaker.Core.Template
{
    /// <summary>
    /// 标签插件集合
    /// </summary>
    public class TemplatePlugIns
    {
        /// <summary>
        /// 已注册标签
        /// </summary>
        private static IDictionary<string, ITemplate> m_Templates = new Dictionary<string, ITemplate>();
        /// <summary>
        /// 已注册标签
        /// </summary>
        public static IDictionary<string, ITemplate> Templates
        {
            get { return m_Templates; }
            set { m_Templates = value; }
        }

        ///// <summary>
        ///// 注册标签
        ///// </summary>
        ///// <param name="tag">标签实例</param>
        //public static void RegisterTemplate(ITemplate template)
        //{
        //    m_Templates.Add(template.TemplateName, template.ToString());
        //}

        ///// <summary>
        ///// 实例化模板
        ///// </summary>
        ///// <param name="templateName">模板名称</param>
        ///// <returns></returns>
        //public static ITemplate InstanceTemplate(string templateName)
        //{
        //    string typeName = m_Templates[templateName];
        //    if (typeName == null)
        //    {
        //        return null;
        //    }
        //    Type t = Type.GetType(typeName);
        //    ITemplate tag = (ITemplate)t.Assembly.CreateInstance(t.FullName);
        //    return tag;
        //}
    }
}
